package example3;

public class WriterFactory {
	public IWriter getWriter(String name){
		if(name.equals("UsbDiskWriter")){
			return new UsbDiskWriter();
		}
		else if(name.equals("FloppyWriter")){
			return new FloppyWriter();
		}
		else if(name.equals("DbWriter")){
			return new DbWriter();
		}
		else{
			throw new IllegalArgumentException("参数不正确");
		}
	}
}
